package com.dcloud.manage.service.impl;

import com.dcloud.manage.request.SourceParamsChangeRequest;
import com.dcloud.manage.request.SourceParamsRequest;
import com.dcloud.manage.service.entity.CollectSourceParam;
import com.dcloud.manage.mapper.CollectSourceParamMapper;
import com.dcloud.manage.service.ICollectSourceParamService;
import com.dcloud.manage.vo.CollectSourceParamVO;
import org.checkerframework.checker.units.qual.C;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 数据源参数表
 * @Author: jeecg-boot
 * @Date:   2022-09-07
 * @Version: V1.0
 */
@Service
public class CollectSourceParamServiceImpl extends ServiceImpl<CollectSourceParamMapper, CollectSourceParam> implements ICollectSourceParamService {

    @Autowired
    private CollectSourceParamMapper collectSourceParamMapper;


    @Override
    public List<CollectSourceParamVO> getListBySourceId(SourceParamsRequest sourceParamsRequest) {
        List<CollectSourceParamVO> list = collectSourceParamMapper.getListBySourceId(sourceParamsRequest);
        return list;
    }

    @Override
    public boolean changeParam(SourceParamsChangeRequest sourceParamsRequest) {
        CollectSourceParam collectSourceParam = new CollectSourceParam();
        BeanUtils.copyProperties(sourceParamsRequest,collectSourceParam);
        int i = collectSourceParamMapper.updateById(collectSourceParam);
        return i > 0;
    }
}
